package hhm.javamode.iterator.phone;

public class Test {

	public static void main(String[] args) {
		ContainerImpl containerImpl = new ContainerImpl();

		containerImpl.add(new Phone("xiaomi", "xiaomi 3", 2000));
		containerImpl.add(new Phone("meizu", "meizu mx 3", 1500));
		containerImpl.add(new Phone("xiaomi", "xiaomi 4", 3000));
		containerImpl.add(new Phone("xiaomi", "xiaomi 5", 3500));

		int plan = 2;

		if (plan == 1) {
			containerImpl.setPlan(PlanAIterator.class);
		} else if (plan == 2) {
			containerImpl.setPlan(PlanBIterator.class);

		}

		Iterator iterator = containerImpl.iterator();
		while (iterator.hasNext()) {
			Phone phone = (Phone) iterator.next();
			System.out.println(phone.toString());
		}

	}
}
